package cn.bobohost.crmrbac.web.controller;

import cn.bobohost.crmrbac.pojo.po.Permission;
import cn.bobohost.crmrbac.pojo.query.QueryObject;
import cn.bobohost.crmrbac.service.PermissionService;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 波波老师
 * @since 2025-05-21
 */
@Controller
@RequestMapping("/permission")
@RequiredArgsConstructor
public class PermissionController {
    //注入权限服务层
    private final PermissionService permissionService;

    @RequestMapping("/list")
    public String list(Model model, @ModelAttribute("qo") QueryObject queryObject){
        //调用业务层获取数据
        PageInfo<Permission> pageInfo = permissionService.selectPermissionListPage(queryObject);
        //传到页面
        model.addAttribute("pageInfo",pageInfo);
        //跳转到页面
        return "permission/list";
    }

}
